#include <stdio.h>


void showScorce(int *arr, int n)
{
    int fenduan[10] = {0};


    for (int i = 0; i < n; i++)
    {
        fenduan[(arr[i] - 1) / 10]++;
    }
    printf("\n分段统计:\n");

    for (int i = 0; i < 10; i++)
    {
        if(fenduan[i] == 0) continue;
        printf("%d-%d: ", i * 10 + 1, (i + 1) * 10);
        for (int j = 0; j < fenduan[i]; j++)
        {
            printf("*");
        }
        printf("(%d)", fenduan[i]);
        printf("\n");
    }
}


int main() {
    int scores[50];
    int n, i, sum = 0, max = -1;
    int gradeA = 0, gradeB = 0, gradeC = 0, gradeD = 0, gradeF = 0;
        printf("请输入学生人数: ");
    if(scanf("%d", &n) != 1 || n <= 0 || n > 50) {
        printf("输入无效！请输入1-50之间的数字\n");
        return 1;
    }

    for(i = 0; i < n; i++) {
        printf("输入第%d个学生的成绩(0-100): ", i+1);
        if(scanf("%d", &scores[i]) != 1 || scores[i] < 0 || scores[i] > 100) {
            printf("成绩无效！请输入0-100之间的整数\n");
            return 1;
        }

        sum += scores[i];

        if(scores[i] > max) {
            max = scores[i];
        }

        if(scores[i] >= 90) gradeA++;
        else if(scores[i] >= 80) gradeB++;
        else if(scores[i] >= 70) gradeC++;
        else if(scores[i] >= 60) gradeD++;
        else gradeF++;
    }


    printf("\n平均分: %.2f\n", (float)sum/n);
    printf("最高分: %d\n", max);

    showScorce(scores, n);

    return 0;
}